#ifndef __PID_H
#define __PID_H

#include "stm32f4xx.h"                 

typedef struct 
{
    float kp;
    float ki;
    float kd;
    float desired;
    float error;
    float preverror;
    float integ;
    float deriv;
    float MaxValue;
    float MinValue;
    float out;
}PidObject;


typedef struct 
{
    float kp;
    float ki;
    float desired;
    float error;
    float preverror;
    float integ;
    float deriv;
    float MaxValue;
    float MinValue;
    float out;
    float out_last;
    float sum;
    float kc;
    uint8_t out_flag;
}PidObject_Z;

void PidInit(PidObject *pid, float desired, float KP, float KI, float KD, int Max, int Min);
float pidout(PidObject *pid, float measure);
void PidInit_z(PidObject_Z *pid, float KP, float KI, int Max, int Min);
float pidout_z(PidObject_Z *pid,  float measure);

#endif
